#pragma once

#include <vgraph>
#include "../EventArgs.h"

class CanvasChangedEventArgs : public EventArgs_flag
{
private: bool _enabled;
private: static CanvasChangedEventArgs& _EnableChangedEventArgs(){static CanvasChangedEventArgs _enabledEventArgs; return _enabledEventArgs;}
public:
	enum {WHOLE = 0x01,BOUNDBOX = 0x02,VERTICAL_POSITION = 0x04,HORIZONTAL_POSITION = 0x08};
	static bool IsEnabled(){return CanvasChangedEventArgs::_EnableChangedEventArgs()._enabled;}
	static void EnableChanged(bool enable=true){CanvasChangedEventArgs::_EnableChangedEventArgs()._enabled = enable;}

	static CanvasChangedEventArgs WholeChanged(){CanvasChangedEventArgs args = _EnableChangedEventArgs(); args.flag |= WHOLE;return args;}
	static CanvasChangedEventArgs BoundboxChanged(const Rect& boundbox) {CanvasChangedEventArgs args = _EnableChangedEventArgs();args.boundbox = boundbox; args.flag |= BOUNDBOX;return args;}
	static CanvasChangedEventArgs VerticalPositionChanged(real position) {CanvasChangedEventArgs args = _EnableChangedEventArgs();args.position = position;args.flag |= VERTICAL_POSITION;return args;}
	static CanvasChangedEventArgs HorizontalPositionChanged(real position) {CanvasChangedEventArgs args = _EnableChangedEventArgs();args.position = position;args.flag |= HORIZONTAL_POSITION;return args;}

	const Rect& GetBoundbox() const {return boundbox;}
	real GetPosition() const {return position;}
	virtual bool IsWholeChanged() const {return flag&WHOLE;}

protected:
	CanvasChangedEventArgs() {_enabled = true;}
	Rect boundbox;
	real position;
};